home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / bbs_util / bsrc_260.zip / INCLUDE.ZIP / SQUISH.H < prev    next >
C/C++ Source or Header  |  1996-02-20  |  10KB  |  246 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*              (C) Copyright 1987-96, Bit Bucket Software Co.              */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                                                                          */
  14. /*                     Squish definitions for BinkleyTerm                   */
  15. /*                                                                          */
  16. /*                                                                          */
  17. /*    For complete  details  of the licensing restrictions, please refer    */
  18. /*    to the License  agreement,  which  is published in its entirety in    */
  19. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.260.    */
  20. /*                                                                          */
  21. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  22. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  23. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  24. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  25. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  26. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  27. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  28. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  29. /*                                                                          */
  30. /*                                                                          */
  31. /* You can contact Bit Bucket Software Co. at any one of the following      */
  32. /* addresses:                                                               */
  33. /*                                                                          */
  34. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  35. /* P.O. Box 460398                AlterNet 7:42/1491                        */
  36. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  37. /*                                Internet f491.n343.z1.fidonet.org         */
  38. /*                                                                          */
  39. /* Please feel free to contact us at any time to share your comments about  */
  40. /* our software and/or licensing policies.                                  */
  41. /*                                                                          */
  42. /*--------------------------------------------------------------------------*/
  43.  
  44. #if !defined _sqhish_h_defined
  45. #define _sqhish_h_defined
  46.  
  47. typedef short WORD;
  48. typedef unsigned short sword;
  49. typedef long dword;
  50. typedef unsigned long FOFS;
  51. typedef unsigned long UMSGID;
  52.  
  53. struct _stamp                    /* DOS-style datestamp */
  54. {
  55.     struct
  56.     {
  57.         /* IBM Cset/2 is allergic to "unsigned short" when declaring bitfields! */
  58.  
  59. #ifdef __IBMC__
  60.         unsigned int da:5;
  61.         unsigned int mo:4;
  62.         unsigned int yr:7;
  63. #else
  64.         /*lint -e46 */
  65.         WORD da:5;
  66.         WORD mo:4;
  67.         WORD yr:7;
  68.         /*lint -restore */
  69. #endif
  70.     } date;
  71.  
  72.     struct
  73.     {
  74. #ifdef __IBMC__
  75.         unsigned int ss:5;
  76.         unsigned int mm:6;
  77.         unsigned int hh:5;
  78. #else
  79.         /*lint -e46 */
  80.         WORD ss:5;
  81.         WORD mm:6;
  82.         WORD hh:5;
  83.         /*lint -restore */
  84. #endif
  85.     } time;
  86. };
  87.  
  88. struct _dos_st
  89. {
  90.     WORD date;
  91.     WORD time;
  92. };
  93.  
  94. /* Union so we can access stamp as "int" or by individual components */
  95.  
  96. union stamp_combo
  97. {
  98.     dword ldate;
  99.     struct _stamp msg_st;
  100.     struct _dos_st dos_st;
  101. };
  102.  
  103. typedef union stamp_combo SCOMBO;
  104.  
  105. /* Field sizes in XMSG */
  106.  
  107. #define XMSG_FROM_SIZE  36
  108. #define XMSG_TO_SIZE    36
  109. #define XMSG_SUBJ_SIZE  72
  110.  
  111. /* Number of reply fields in XMSG.replies */
  112.  
  113. #define MAX_REPLY 9
  114.  
  115. /* The network address structure.  The z/n/n/p fields are always             *
  116.  * maintained in parallel to the 'ascii' field, which is simply an ASCII     *
  117.  * representation of the address.  In addition, the 'ascii' field can        *
  118.  * be used for other purposes (such as internet addresses), so the           *
  119.  * contents of this field are implementation-defined, but for most cases,    *
  120.  * should be in the format "1:123/456.7" for Fido addresses.                 */
  121.  
  122. typedef struct _netaddr
  123. {
  124.     WORD zone;
  125.     WORD net;
  126.     WORD node;
  127.     WORD point;
  128. } NETADDR;
  129.  
  130. typedef struct _sqbase
  131. {
  132.     WORD len;                    /* LENGTH OF THIS STRUCTURE! *//*   0 */
  133.     WORD rsvd1;                    /* reserved *//*   2 */
  134.  
  135.     dword num_msg;                /* Number of messages in area *//*   4 */
  136.     dword high_msg;                /* Highest msg in area. Same as num_msg*//*   8 */
  137.     dword skip_msg;                /* Skip killing first x msgs in area *//*  12 */
  138.     dword high_water;            /* Msg# (not umsgid) of HWM *//*  16 */
  139.  
  140.     dword uid;                    /* Number of the next UMSGID to use *//*  20 */
  141.  
  142.     byte base[80];                /* Base name of SquishFile *//*  24 */
  143.  
  144.     FOFS begin_frame;            /* Offset of first frame in file *//* 104 */
  145.     FOFS last_frame;            /* Offset to last frame in file *//* 108 */
  146.     FOFS free_frame;            /* Offset of first FREE frame in file *//* 112 */
  147.     FOFS last_free_frame;        /* Offset of last free frame in file *//* 116 */
  148.     FOFS end_frame;                /* Pointer to end of file *//* 120 */
  149.  
  150.     dword max_msg;                /* Max # of msgs to keep in area *//* 124 */
  151.     WORD keep_days;                /* Max age of msgs in area (SQPack) *//* 128 */
  152.     WORD sz_sqhdr;                /* sizeof(SQHDR) *//* 130 */
  153.     byte rsvd2[124];            /* Reserved by Squish for future use*//* 132 */
  154.     /* total: 256 */
  155. } SQBASE, *PSQBASE;
  156.  
  157. typedef struct _sqhdr
  158. {
  159. #define SQHDRID       0xafae4453L
  160.  
  161.     dword id;                    /* sqhdr.id must always equal SQHDRID */
  162.  
  163.     FOFS next_frame;            /* Next frame in the linked list */
  164.     FOFS prev_frame;            /* Prior frame in the linked list */
  165.  
  166.     dword frame_length;            /* Length of this frame */
  167.     dword msg_length;            /* Length used in this frame by XMSG, ctrl and text */
  168.     dword clen;                    /* Length used in this frame by ctrl info only */
  169.  
  170.     WORD frame_type;            /* Type of frame -- see above FRAME_XXXX */
  171.     WORD rsvd;                    /* Reserved for future use */
  172. } SQHDR, *PSQHDR;
  173.  
  174. /* No frame offset */
  175.  
  176. #define NULL_FRAME      ((FOFS)0L)
  177.  
  178. /* Frame types for sqhdr.frame_type */
  179.  
  180. #define FRAME_NORMAL    0x00    /* Normal text frame */
  181. #define FRAME_FREE      0x01    /* Part of the free chain */
  182. #define FRAME_LZSS      0x02    /* Not implemented */
  183. #define FRAME_UPDATE    0x03    /* Frame is being updated by another task */
  184.  
  185. /* The eXtended message structure.  Translation between this structure, and *
  186.  * the structure used by the individual message base formats, is done       *
  187.  * on-the-fly by the API routines.                                          */
  188.  
  189. typedef struct _xmsg
  190. {
  191.     dword attr;
  192.  
  193.     byte from[XMSG_FROM_SIZE];
  194.     byte to[XMSG_TO_SIZE];
  195.     byte subj[XMSG_SUBJ_SIZE];
  196.  
  197.     NETADDR orig;                /* Origination and destination addresses             */
  198.     NETADDR dest;
  199.  
  200.     struct _stamp date_written;    /* When user wrote the msg (UTC)            */
  201.     struct _stamp date_arrived;    /* When msg arrived on-line (UTC)           */
  202.     sword utc_ofs;                /* Offset from UTC of message writer, in    *
  203.                                  * minutes.                                 */
  204.  
  205.     UMSGID replyto;                /* This is a reply to message #x            */
  206.     UMSGID replies[MAX_REPLY];    /* Replies to this message                  */
  207.     dword umsgid;                /* UMSGID of this message, if (attr&MSGUID) */
  208.     /* This field is only stored on disk -- it  *
  209.                                  * is not read into memory.                 */
  210.  
  211.     byte __ftsc_date[20];        /* Obsolete date information.  If it weren't for the *
  212.                                  * fact that FTSC standards say that one cannot      *
  213.                                  * modify an in-transit message, I'd be VERY         *
  214.                                  * tempted to axe this field entirely, and recreate  *
  215.                                  * an FTSC-compatible date field using               *
  216.                                  * the information in 'date_written' upon            *
  217.                                  * export.  Nobody should use this field, except     *
  218.                                  * possibly for tossers and scanners.  All others    *
  219.                                  * should use one of the two binary datestamps,      *
  220.                                  * above.                                            */
  221. } XMSG, *PXMSG;
  222.  
  223. /* Bitmasks for XMSG.attr */
  224.  
  225. #define MSGPRIVATE 0x0001
  226. #define MSGCRASH   0x0002
  227. #define MSGREAD    0x0004
  228. #define MSGSENT    0x0008
  229. #define MSGFILE    0x0010
  230. #define MSGFWD     0x0020
  231. #define MSGORPHAN  0x0040
  232. #define MSGKILL    0x0080
  233. #define MSGLOCAL   0x0100
  234. #define MSGHOLD    0x0200
  235. #define MSGXX2     0x0400
  236. #define MSGFRQ     0x0800
  237. #define MSGRRQ     0x1000
  238. #define MSGCPT     0x2000
  239. #define MSGARQ     0x4000
  240. #define MSGURQ     0x8000
  241.  
  242. #define MSGSCANNED 0x00010000L    /* Message has been exported to the network */
  243. #define MSGUID     0x00020000L    /* xmsg.uid field contains umsgid of msg */
  244.  
  245. #endif                            /*_sqhish_h_defined*/
  246.